package com.kmxd.ams.client.archive.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 门类配置-元数据
 *
 * @author ZuoLG
 * @since 2022-07-15
 */
@Data
@Schema(description = "门类配置-元数据对象")
public class ArchiveFieldVO implements Serializable {

  private static final long serialVersionUID = 1L;

  @Schema(description = "主键ID")
  @JsonSerialize(using = ToStringSerializer.class)
  private Long id;

  @Schema(description = "门类配置id 关联s_archive_type表主键")
  @JsonSerialize(using = ToStringSerializer.class)
  private Long archTypeId;

  @Schema(description = "所属表名")
  private String tableId;

  /** 数据库字段 */
  @Schema(description = "数据库字段")
  private String dbFieldKey;

  /** 字段说明 */
  @Schema(description = "字段说明")
  private String dbFieldName;

  @Schema(description = "是否允许为空0否 1是")
  private Boolean dbIsNull;

  @Schema(description = "数据库字段类型")
  private String dbType;

  @Schema(description = "数据库字段长度")
  @JsonSerialize(using = ToStringSerializer.class)
  private Integer dbLength;

  @Schema(description = "表单控件长度")
  @JsonSerialize(using = ToStringSerializer.class)
  private Integer fieldLength;

  @Schema(
      description =
          "引用的字典code 0无, sex性别, gb稿本, jbkd脊背宽度, purposeofborrow借阅目的, safecode实体登记, secret密级")
  private String dictField;

  @Schema(description = "著录控件 单行输入、多行输入、选人、选部门、日历、单选下拉列表、多选下拉列表,")
  private String widget;

  @Schema(
      description =
          "自动填写 {user_id}{user_name}{departmentid}{departmentname}{year}{lastyear}{date}{datetime}")
  private String widgetDefault;

  @Schema(description = "是否继承上级 0否，1是")
  private Boolean attrExtends;

  @Schema(description = "上级table_id 上级表名")
  private String extendsTableId;

  @Schema(description = "上级字段名 上级字段名")
  private String extendsField;

  @Schema(description = "是否统计下级 0否，1是")
  private Boolean attrSummary;

  @Schema(description = "下级表名 下级表名")
  private String summaryTableId;

  @Schema(description = "下级字段名 下级字段名")
  private String summaryField;

  @Schema(description = "统计下级算法 最大值max，最小值min，平均值avg，合计sum，计录数count")
  private String summaryType;

  @Schema(description = "数据出现重复时是否提醒 0否，1是")
  private Boolean attrRepeatWarn;

  @Schema(description = "数据出现重复时是否提醒(归档)")
  private Boolean attrRepeatWarnArrange;

  @Schema(description = "数据为空时是否提醒 0否，1是")
  private Boolean attrEmptyWarn;

  /** 整理库 数据为空时是否提醒 0否，1是 */
  @Schema(description = "整理库 数据为空时是否提醒 0否，1是")
  private Boolean attrEmptyWarnArrange;

  @Schema(description = "是否利用可见 0否，1是（原字段attrshow）")
  private Boolean attrUse;

  @Schema(description = "是否允许编辑 0否，1是")
  private Boolean attrEdit;

  /** 追加复制 0否，1是 */
  @Schema(description = "追加复制 0否，1是")
  private Boolean attrCopy;

  /** 是否列表显示 0否，1是（原字段attrshow） */
  @Schema(description = "是否列表显示 0否，1是")
  private Boolean attrList;

  @Schema(description = "类型 0系统内置版本，1用户版本")
  @JsonSerialize(using = ToStringSerializer.class)
  private Integer attrSystem;

  @Schema(description = "占位符个数")
  @JsonSerialize(using = ToStringSerializer.class)
  private Integer colSpan;

  @Schema(description = "控件界面高度")
  @JsonSerialize(using = ToStringSerializer.class)
  private Integer rowSpan;

  @Schema(description = "是否需要更新索引 是否需要更新索引，1需要，其它不需要")
  private Boolean esIndex;

  @Schema(description = "是否是数据库索引0不是，1是")
  private Boolean dbIndex;

  @Schema(description = "是否AIP封装 0不封装 1封装")
  private Boolean xmlExport;

  @Schema(description = "封装别名 自定义名称以符合da/t48元数据名称要求")
  private String xmlAlias;

  @Schema(description = "字典值存储方式 name、value")
  private String dictStorage;

  @Schema(description = "字典值显示方式 name、value")
  private String dictShow;

  @Schema(description = "自定义表头宽度")
  @JsonSerialize(using = ToStringSerializer.class)
  private Integer headerWidth;

  /** 元数据分组，元数据分组，0：内容，1：归档情况，2：管理信息，3：卷信息，4：其它信息 */
  @Schema(description = "元数据分组")
  @JsonSerialize(using = ToStringSerializer.class)
  private Long fieldGroup;

  @Schema(description = "列表排序")
  private Integer sortList;

  @Schema(description = "排序")
  private Integer sort;

  @Schema(description = "前端检索字段 0否，1是")
  private Boolean attrSearch;

  @Schema(description = "创建人")
  @JsonSerialize(using = ToStringSerializer.class)
  private Long createBy;

  @Schema(description = "创建时间")
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private Date createTime;

  @Schema(description = "更新人")
  @JsonSerialize(using = ToStringSerializer.class)
  private Long updateBy;

  @Schema(description = "更新时间")
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private Date updateTime;
}
